package com.baozhun.mall.common.model.bean

import android.text.TextUtils
import androidx.annotation.Keep
import com.alibaba.android.arouter.launcher.ARouter
import com.baozhun.mall.common.arouter.RoutePath
import com.baozhun.mall.common.util.Constants
import java.io.Serializable

/**
 * @Title：
 * @Description：
 * @Author：xing.luo
 * @Since：2022/12/10
 * @Version：1.0.0
 */
@Keep
class CommonRedirectBean(var id: String,
                         var type: Int, // 1-自定义活动（H5）， 2-商品池， 3-活动内页（专题）
                         var title: String,
                         var link: String,
                         var img: String,
                         var goods_list: MutableList<GoodsInfoBean>
) : Serializable {
    var category_id: String? = ""
    var page_id: String? = ""
    var activity_id: String? = ""
    var data_source: String = ""

    fun jumpPage() {
        when(type){
            1 -> {
                ARouter.getInstance().build(RoutePath.Common.WEB_CONTAINER)
                    .withString(Constants.Common.BUNDLE_NAME, link)
                    .withString(Constants.Common.TITLE, title)
                    .navigation()
            }
            3 -> activity_id?.let{
                ARouter.getInstance().build(RoutePath.Home.ACTIVITY_DETAIL)
                    .withSerializable(Constants.Common.BUNDLE_NAME, ActivityInfoBean(it, Constants.Common.TYPE_ACTIVITY))
                    .withString(Constants.Common.DATA_SOURCE, data_source)
                    .withString(Constants.Common.TITLE, title)
                    .navigation()
            }
            2 -> {
                category_id?.let {
                    ARouter.getInstance().build(RoutePath.Home.ACTIVITY_DETAIL)
                        .withSerializable(Constants.Common.BUNDLE_NAME, ActivityInfoBean(it, Constants.Common.TYPE_CLASSIFY))
                        .withString(Constants.Common.DATA_SOURCE, data_source)
                        .withString(Constants.Common.TITLE, title)
                        .navigation()
                }
            }
        }
    }
}